package tree;

public class TreeNode<T,E> {
	/**
	 * 节点的ID
	 */
	private T id;
	/**
	 * 节点的父ID
	 */
	private T pid;
	/**
	 * 树存储的对象
	 */
	private E bean;
	/**
	 * 是否展开，默认true
	 */
	private boolean open = true;
	/**
	 * 是否可点击，默认true
	 */
	private boolean clickable = true;
	/**
	 * 是否叶子节点，默认true
	 */
	private boolean leaf = true;
	/**
	 * tree的级数，顶层为0级
	 */
	private int level = 0;

	public TreeNode(T id, T pid, E bean) {
		this.id = id;
		this.pid = pid;
		this.bean = bean;
	}

	public TreeNode(T id, T pid, E bean, boolean open, boolean clickable) {
		this.id = id;
		this.pid = pid;
		this.bean = bean;
		this.open = open;
		this.clickable = clickable;
	}

	public TreeNode(T id, T pid, E bean, boolean open, boolean clickable, boolean leaf) {
		this.id = id;
		this.pid = pid;
		this.bean = bean;
		this.open = open;
		this.clickable = clickable;
		this.leaf = leaf;
	}

	public T getId() {
		return id;
	}

	public void setId(T id) {
		this.id = id;
	}

	public T getPid() {
		return pid;
	}

	public void setPid(T pid) {
		this.pid = pid;
	}

	public E getBean() {
		return bean;
	}

	public void setBean(E bean) {
		this.bean = bean;
	}

	public boolean isOpen() {
		return open;
	}

	public void setOpen(boolean open) {
		this.open = open;
	}

	public boolean isClickable() {
		return clickable;
	}

	public void setClickable(boolean clickable) {
		this.clickable = clickable;
	}

	public boolean isLeaf() {
		return leaf;
	}

	public void setLeaf(boolean leaf) {
		this.leaf = leaf;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}
}
